package com.mytaobao.main;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by hp on 2017/3/30.
 */

public abstract class BaseSimplePagerAdapterFragment extends Fragment {

    /**
     * The fragment argument representing the section number for this fragment.
     */
    protected static final String ARG_SECTION_NUMBER = "section_number";
    /**
     * Returns a new instance of this fragment for the given section number.
     */

    protected View rootView;

    protected int sectionNumber;

    protected static BaseSimplePagerAdapterFragment createNewInstance(int sectionNumber, BaseSimplePagerAdapterFragment baseSimplePagerAdapterFragment) {
        BaseSimplePagerAdapterFragment fragment = baseSimplePagerAdapterFragment;
        Bundle args = new Bundle();
        args.putInt(ARG_SECTION_NUMBER, sectionNumber);
        fragment.setArguments(args);
        return fragment;
    }
    public BaseSimplePagerAdapterFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        rootView = inflater.inflate(getAdapterLayoutView(), container, false);
        sectionNumber = this.getArguments().getInt(ARG_SECTION_NUMBER);
        _onCreateView();
        return rootView;
    }

    protected abstract void _onCreateView();
    protected abstract int getAdapterLayoutView();
}
